//@author A0083782W
#include "InternalCommand.h"

Hinter* const _hinterPtr = &Hinter::get();

InternalCommand::InternalCommand() {
	reset();
}

void InternalCommand::trigger_generateHistory() {
	_myOptType = InternalType::GET_HISTORY;
	analyseInternal();
}

void InternalCommand::trigger_moveToTail() {
	_myOptType = InternalType::MOVE_TO_TAIL;
	analyseInternal();
}

void InternalCommand::trigger_moveUp() {
	_myOptType = InternalType::MOVE_FRONT;
	analyseInternal();
}

void InternalCommand::trigger_moveDown() {
	_myOptType = InternalType::MOVE_BACK;
	analyseInternal();
}

void InternalCommand::trigger_pushBack(con_str &userInput) {
	_myOptType = InternalType::PUSH_HISTORY;
	_currentInput = userInput;
	analyseInternal();
}	

void InternalCommand::trigger_callEvents() {
	_myOptType = InternalType::CALL_EVENTS;
	analyseInternal();
}

void InternalCommand::trigger_markRemind() {
	_myOptType = InternalType::MARK_AS_REMIND;
	analyseInternal();
}

void InternalCommand::trigger_markDone() {
	_myOptType = InternalType::MARK_AS_DONE;
	analyseInternal();
}

void InternalCommand::trigger_markMissed() {
	_myOptType = InternalType::MARK_AS_MISSED;
	analyseInternal();
}

void InternalCommand::trigger_hinter (con_str &userInput) {
	_myOptType = InternalType::GET_HINT;
	_currentInput = userInput;
	analyseInternal();
}

void InternalCommand::trigger_dequeueDueEvents() {
	_myOptType = InternalType::DEQUEUE_EVENTS;
	analyseInternal();
}

void InternalCommand::trigger_startUp() {
	_myOptType = InternalType::START_UP;
	analyseInternal ();
}

InternalType InternalCommand::getInternalType() const {
	return _myOptType;
}

void InternalCommand::reset() {
	_myOptType = InternalType::UNCLEAR;
	_currentInput = NULL_STRING;
}

string InternalCommand::getCurrentInput() const {
	return _currentInput;
}

void InternalCommand::analyseInternal() const {
	giveMeToOperations (this);
}

static void giveMeToOperations (const InternalCommand *aCommand) {
	Operations::get().executeInternal (*aCommand);
}